<?php

/**
 * News filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseNewsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'           => new sfWidgetFormFilterInput(),
      'author'          => new sfWidgetFormFilterInput(),
      'source'          => new sfWidgetFormFilterInput(),
      'tag'             => new sfWidgetFormFilterInput(),
      'catalog_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'sub_catalog_id'  => new sfWidgetFormFilterInput(),
      'publish_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'create_time'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'snapshot_big'    => new sfWidgetFormFilterInput(),
      'snapshot_normal' => new sfWidgetFormFilterInput(),
      'snapshot_small'  => new sfWidgetFormFilterInput(),
      'brief'           => new sfWidgetFormFilterInput(),
      'brief_title'     => new sfWidgetFormFilterInput(),
      'short_comment'   => new sfWidgetFormFilterInput(),
      'hit_i'           => new sfWidgetFormFilterInput(),
      'hit_mask_i'      => new sfWidgetFormFilterInput(),
      'keyword'         => new sfWidgetFormFilterInput(),
      'status_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'member_level_i'  => new sfWidgetFormFilterInput(),
      'body'            => new sfWidgetFormFilterInput(),
      'is_audit_b'      => new sfWidgetFormFilterInput(),
      'daily_hit'       => new sfWidgetFormFilterInput(),
      'weekly_hit'      => new sfWidgetFormFilterInput(),
      'monthly_hit'     => new sfWidgetFormFilterInput(),
      'system_user_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'user_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => true)),
      'is_header_b'     => new sfWidgetFormFilterInput(),
      'is_recommend_b'  => new sfWidgetFormFilterInput(),
      'is_on_top_b'     => new sfWidgetFormFilterInput(),
      'is_focus_b'      => new sfWidgetFormFilterInput(),
      'body_test'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'title'           => new sfValidatorPass(array('required' => false)),
      'author'          => new sfValidatorPass(array('required' => false)),
      'source'          => new sfValidatorPass(array('required' => false)),
      'tag'             => new sfValidatorPass(array('required' => false)),
      'catalog_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog'), 'column' => 'catalog_id')),
      'sub_catalog_id'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'publish_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'create_time'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'snapshot_big'    => new sfValidatorPass(array('required' => false)),
      'snapshot_normal' => new sfValidatorPass(array('required' => false)),
      'snapshot_small'  => new sfValidatorPass(array('required' => false)),
      'brief'           => new sfValidatorPass(array('required' => false)),
      'brief_title'     => new sfValidatorPass(array('required' => false)),
      'short_comment'   => new sfValidatorPass(array('required' => false)),
      'hit_i'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'hit_mask_i'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'keyword'         => new sfValidatorPass(array('required' => false)),
      'status_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Status'), 'column' => 'status_id')),
      'member_level_i'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'body'            => new sfValidatorPass(array('required' => false)),
      'is_audit_b'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'daily_hit'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'weekly_hit'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'monthly_hit'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'system_user_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Systemuser'), 'column' => 'system_user_id')),
      'user_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Users'), 'column' => 'user_id')),
      'is_header_b'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_recommend_b'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_on_top_b'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_focus_b'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'body_test'       => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('news_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'News';
  }

  public function getFields()
  {
    return array(
      'news_id'         => 'Number',
      'title'           => 'Text',
      'author'          => 'Text',
      'source'          => 'Text',
      'tag'             => 'Text',
      'catalog_id'      => 'ForeignKey',
      'sub_catalog_id'  => 'Number',
      'publish_time'    => 'Date',
      'create_time'     => 'Date',
      'modify_time'     => 'Date',
      'snapshot_big'    => 'Text',
      'snapshot_normal' => 'Text',
      'snapshot_small'  => 'Text',
      'brief'           => 'Text',
      'brief_title'     => 'Text',
      'short_comment'   => 'Text',
      'hit_i'           => 'Number',
      'hit_mask_i'      => 'Number',
      'keyword'         => 'Text',
      'status_id'       => 'ForeignKey',
      'member_level_i'  => 'Number',
      'body'            => 'Text',
      'is_audit_b'      => 'Number',
      'daily_hit'       => 'Number',
      'weekly_hit'      => 'Number',
      'monthly_hit'     => 'Number',
      'system_user_id'  => 'ForeignKey',
      'user_id'         => 'ForeignKey',
      'is_header_b'     => 'Number',
      'is_recommend_b'  => 'Number',
      'is_on_top_b'     => 'Number',
      'is_focus_b'      => 'Number',
      'body_test'       => 'Text',
    );
  }
}
